
		<%= render 'public/flash_notice' %>

  		<div id="module_win">
  			
  		</div>

  		<%= form_tag cpanel_groups_path, method: 'get', :class => "form-search" do %>
  			<%= text_field_tag :search, params[:search],:placeholder => "输入小组名称" %>
  			<%= submit_tag "查找", :name => nil,  :class => 'btn' %>
  		<% end -%>

    	<table id="groups" class="table table-striped">
    		<thead>
				<tr>
					<th><%= check_box_tag 'checkbox_all' %> </th>
					
					<th>组名</th>
					<th>话题数</th>
					<th>成员数量</th>
					<th>创建时间</th>
					<th>状态</th>
					<td>操作</td>
				</tr>
			</thead>
			<tbody>
    		<% @groups.each do |group| %>
    		
				<tr>
					<td><%= check_box_tag 'checkbox_name', group.id %></td>
					
					<td><%= truncate group.name, length: 5 %></td>
					<td><%= group.topic_num %></td>
					<td><%= group.member_num + 1 %></td>
					<td><%= format_datetime group.created_at,'%Y-%m-%d %H:%M' %></td>

					<% if group.state %>
						<td>可用</td>
					<% else %>
						<td>不可用</td>
					<% end %>
					<td>
						<%= link_to '查看', cpanel_group_path(group), remote: true %>
						<%= link_to '删除', [:cpanel, group], confirm: '确认删除吗？', method: :delete %>
						<% if group.state %>
							<%= link_to '置为不可用', change_status_cpanel_group_path(group) %>
						<% else %>
							<%= link_to '置为可用', change_status_cpanel_group_path(group) %>
						<% end %>
					</td>
				</tr>
			
    		<% end -%>
    		</tbody>
		</table>
		<div class="paginate-right-position">
			<%= will_paginate @groups, :previous_label =>'上一页', :next_label => '下一页' %>
		</div>
